$(function () {
    findAll();
});
function findAll() {
    let result = myAjax("/hr", {}, "get");
    setDataCompany(result.companyModel);
    setConsultingData(result.consultingModelList);
    setOnlineData(result.onlineModelList);
    setNavWebsiteData(result.navModelList);
    setNavFirstData(result.navModelList);
    setHrListData(result.hrModelList);
    console.log(result);
}

function setDataCompany(data) {
    $("#logo").attr('src', URI + '/propertyimg'+ data.logo);
    $("#companyName").html(data.name);
    $("#qrCodeIndex").attr("src", URI + '/propertyimg'+ data.qrCodeIndex);
    $("#qrCodeIndexTitle").html(data.qrCodeIndexTitle);
    $("#qrCodeWeiXin").attr("src", URI + '/propertyimg'+ data.qrCodeWeiXin);
    $("#qrCodeWeiXinTitle").html(data.qrCodeWeiXinTitle);
    $("#recordMessage").html(data.recordMessage);
    $("#recordNumber").html(data.recordNumber);
    // $("#address").html(data.address);
    // $("#addressImg").attr("src", data.addressImg);
    // $("#phone").html(data.phone);
    // $("#phoneImg").attr(data.phoneImg);
    // $("#email").html(data.email);
    // $("#emailImg").attr(data.emailImg);
    // $("#nickName").html(data.nickName);
    // $("#tag").html(data.tag);
    // $("#companyContent").html(data.content);
}

/**
 *
 */
function setConsultingData(data) {
    let html = "";
    for (let i = 0; i < data.length; i++) {
        html += "<div>" + data[i].content + "</div>";
    }
    $("#consulting").html(html);
}

/**
 * 第三方网站导航
 */
function setNavWebsiteData(data) {
    let html = "";
    for (let i = 0; i < data.length; i++) {
        if (data[i].typeName === "第三方网站导航") {
            html += "<div><img src=" + URI + '/propertyimg'+ data[i].img + "></div>";
        }
    }
    $("#websiteNav").html(html);
}

/**
 * Online
 */
function setOnlineData(data) {
    let html = "";
    for (let i = 0; i < data.length; i++) {
        html += "<div>" + data[i].content + "</div>";
    }
    $("#online").html(html);
}

/***
 * 一级导航
 * @param data
 */
function setNavFirstData(data) {
    let html = "";
    for (let i = 0; i < data.length; i++) {
        if (data[i].typeName === "一级导航") {
            html += "<a href=" + URI+ data[i].href + "><div>" + data[i].name + "</div></a>";
        }
    }
    $("#firsNav").html(html);

}

/**
 * 人力资源
 */
function setHrListData(data) {
    let html = "";
    for(let i= 0;i<data.length;i++){
        html+="<div>\n" +
            "        <div><a href="+data[i].href+"></a></div>\n" +
            "        <div>"+data[i].title+"</div>\n" +
            "        <div></div>\n" +
            "        <div>"+data[i].contentOne+"</div>\n" +
            "        <div>"+data[i].contentTwo+"</div>\n" +
            "    </div>";
    }
    $("#hrList").html(html);
}
